<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let d = [
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 459016768,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808082829",
            "endTime": "230808093231",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "7cf6872f0fa34a7298035914b2a56ebc"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 348117952,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808093245",
            "endTime": "230808102759",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "1d1f6259c5624002ae7bc4c1d0476891"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 220512288,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808102825",
            "endTime": "230808105845",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "dd256d90a9ac4351adef8a35ff394762"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 3565531936,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808081514",
            "endTime": "230808105845",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "b7cffaf820c1405d91fb39c0a7af70c3"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 106404544,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808111334",
            "endTime": "230808111935",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a7d71a1ebb6248c7b082f34660a966a7"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 421491456,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808131146",
            "endTime": "230808141104",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "24db77a53ce04dfa95d884631719b23f"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 143359936,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808141728",
            "endTime": "230808143938",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "8f592dfa5a2844dabd08db397e3fe646"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 206790464,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808150410",
            "endTime": "230808152838",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "15aebb5b89894399bf4c5c9e9be6bd7d"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 3057249472,
            "src": "TMN",
            "channel": 1,
            "startTime": "230808130515",
            "endTime": "230808152840",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "3b69ac118b6a4bfa823ada92d4d4ad2a"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 325754432,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808082826",
            "endTime": "230808093231",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a4e68d8dde6d4b00a876b6fa2a180938"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 259457152,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808093237",
            "endTime": "230808102759",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "8ef67e31f1934e5b963f877ec29df4ed"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 139041120,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808102819",
            "endTime": "230808105845",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "01c1b82864b046ba9eac923177fcf56a"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 859681376,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808081458",
            "endTime": "230808105845",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a4ada1bf45c34f1ab4b3de68086bc06f"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 14283232,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808111318",
            "endTime": "230808111935",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "3151b892ffe44c6792d5a9b9889c3ccb"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 312642624,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808131139",
            "endTime": "230808141104",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "95d2df2f9e5e40a7946097324bd3e56a"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 61899392,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808141724",
            "endTime": "230808143938",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "ae827c3865374b71beaf6c232332bfd0"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 139032128,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808150404",
            "endTime": "230808152838",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "bac21ce977254450a41e0bebfc63ce4c"
        },
        {
            "storeType": 1,
            "avType": 2,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 710248224,
            "src": "TMN",
            "channel": 2,
            "startTime": "230808130501",
            "endTime": "230808152840",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "5a90793e7a15485db32277eb8bd8cc1e"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 192202400,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808082836",
            "endTime": "230808093232",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "34c66b2ecb74423b855e38ceb0098eea"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 149539744,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808093247",
            "endTime": "230808102800",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "c694406e043c4038a70f01e3fb973dc7"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 92260256,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808102830",
            "endTime": "230808105843",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "683a12e2c4694225994500abc2272e83"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 813722080,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808081457",
            "endTime": "230808105846",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "6b1c26790a0b40f9a97453e0c23dfd9b"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 23298176,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808111318",
            "endTime": "230808111935",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "fe6d83c77100442ba3cff2e67b3a4920"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 194926304,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808131149",
            "endTime": "230808141104",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "dedc2a6761844893af6b7a4a60c6309e"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 52874528,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808141732",
            "endTime": "230808143938",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "d693a51035ba4ec195dd704883efef62"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 85503904,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808150414",
            "endTime": "230808152838",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "0e3630cc26f243f2b6500f9a114feef3"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 726754272,
            "src": "TMN",
            "channel": 3,
            "startTime": "230808130500",
            "endTime": "230808152840",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "1b60fa70e20a480da7b8a78e893b0506"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 179658976,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808082836",
            "endTime": "230808093231",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "b2feafcc58004d36861ea67b25a36d5d"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 141679808,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808093247",
            "endTime": "230808102759",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "bb7abc714bfb461d8bce10d95033e90e"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 86423328,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808102829",
            "endTime": "230808105845",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a754da4a1074404da9ee6ac78dd77690"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 846568160,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808081457",
            "endTime": "230808105846",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "abdca4aeab6d45f2952eb4f4cd061f87"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 32710656,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808111318",
            "endTime": "230808111935",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "d977d1c8e5534d65a32dc953f5d52b88"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 162792352,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808131149",
            "endTime": "230808141104",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "01ca425b335f40c594bf1dcdf6ce3b6f"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 43728096,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808141734",
            "endTime": "230808143938",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "28f0630d0b3846f5a9b17cc3ea5e0e04"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 81139904,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808150414",
            "endTime": "230808152838",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "d7f6c17f683d4cc6b96c16842d916a2d"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 730364192,
            "src": "TMN",
            "channel": 4,
            "startTime": "230808130500",
            "endTime": "230808152840",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a9ccdbcb04f548978952d4c6b0e29896"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 107108800,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808082835",
            "endTime": "230808093231",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "3f2a14abdd084785937b54a60050e3e6"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 98305696,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808093247",
            "endTime": "230808102800",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "d3095303f3bb47b0af8d35840e0c73fd"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 47445728,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808102828",
            "endTime": "230808105844",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "84bc37fe8890486881c7061a9bb6189d"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 719854240,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808081457",
            "endTime": "230808105846",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "c1aa94bff7f644eaad481de0a13afdb6"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 19225792,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808111318",
            "endTime": "230808111934",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "df3dd350697d49c5b2f23ee4a0fb845d"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 1,
            "file": false,
            "ftp": 0,
            "fileSize": 633221440,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808130502",
            "endTime": "230808152840",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "76a7ae90c83849b3941c285cccfba6ae"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 90616160,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808131148",
            "endTime": "230808141103",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "a7bcb3afbfbb47198949f808daa7edd8"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 28179648,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808141733",
            "endTime": "230808143939",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "b4e51ca9e5d748b7b0a92526107ee9aa"
        },
        {
            "storeType": 1,
            "avType": 0,
            "streamType": 2,
            "file": false,
            "ftp": 0,
            "fileSize": 43191136,
            "src": "TMN",
            "channel": 6,
            "startTime": "230808150415",
            "endTime": "230808152839",
            "alarmFlag": "0000000000000000000000000000000000000000000000000000000000000000",
            "fileId": "65977ed21a66422e81f016933868939a"
        }
    ]

    let sum = d.reduce((value, row) => {
        console.log(row)
        return value + parseInt(row.fileSize)
    }, 0)

    console.log("sum:", sum)


    var S4 = function () {
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
    };
    var uuid = S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4();
    var user = encodeURI('admin'), pwd = crypto.createHash('md5').update('登录密码').digest('hex'),
        car = encodeURI('@浙A123456'), file = {文件对象};
    var video_player = flvjs.createPlayer({
        type: 'flv',
        isLive: true,
        hasAudio: false,
        hasVideo: true,
        cors: true,
        url: 'ws://ip:9988/his_tmn_play/' + user + '*' + pwd + '/' + uuid + '/' + encodeURI(car) + '/' + file.channel + '/' + file.avType + '/' + file.streamType + '/' + file.storeType + '/0/0/' + file.startTime + '/' + file.endTime,
        onmsg: function (msg) {
            if (!msg || !msg.cmd) return;
            //播放应答，可能来自终端对播放指令的应答，也可能来自终端上传了视频流，ret代表的含义请查看视频接口返回状态说明
            if (msg.cmd == 'hid_tmn_play') return alert('收到播放应答：' + msg.ret);
            //流量每秒一条
            if (msg.cmd == 'play_flow') return console.log('播放总流量(字节)：' + msg.flow);
        }
    }, {
        enableStashBuffer: false,
        fixAudioTimestampGap: false
    });
    video_player.attachMediaElement(document.getElementById('video'));
    video_player.on(flvjs.Events.MEDIA_INFO, function () {//收到视频流开始播放
        console.log('视频播放成功');
    });
    video_player.load();
    video_player.play();
</script>
</body>
</html>
